/**
 * 自动创建的对应js目录
 * 创建时间：2018-05-18 17:33:14
 * 技术支持：曹传喜
 * 邮箱：15075107120@139.com
 */
$(function () {
    var beginTime = $.util.getRequest('beginTime');
    var endTime = $.util.getRequest('endTime');
    initDatagrid(beginTime, endTime, "");
    initToolbar();
});

function initToolbar() {
    $('#queryButton').click(function () {
        var param = $('#queryForm').serializeObject();
        initDatagrid(param.beginTime, param.endTime, param.queryStr);
    });
}

//初始化表格
function initDatagrid(beginTime, endTime, queryStr) {
    var url = $.util.getRequestJson('/json/statistics.marketingHistory.json');
    url += "?type=0&timeType=0";
    url += "&tellerNo=" + $.util.getRequest('tellerNo');
    url += "&beginTime=" + beginTime;
    url += "&endTime=" + endTime;
    url += "&queryStr=" + queryStr;
    var listTable = $('#listTable').datagrid({
        url: url,
        idField: 'id',
        fit: true,
        pagination: true,
        pageSize: 20,
        checkOnSelect: false,
        selectOnCheck: false,
        singleSelect: true,
        fitColumns: true,
        toolbar: '#toolbarButton',
        onLoadSuccess: function (data) {
            $('#beginTime').my97('setValue', data.data.beginTime);
            $('#endTime').my97('setValue', data.data.endTime);
        },
        columns: [
            [
                {
                    field: 'customerName',
                    width: 10,
                    title: '客户名称'
                },
                {
                    field: 'businessName',
                    title: '办理业务',
                    width: 20
                },
                {
                    field: 'marketingTime',
                    title: '推荐时间',
                    width: 20
                },
                {
                    field: 'score',
                    title: '绩效得分',
                    width: 10
                }
            ]
        ]
    });
}



